package com.xo.file.config.ConfigurationProperties;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@ConfigurationProperties(prefix = "tx-cos")
@Component
@Schema(description = "腾讯云COS配置")
@Data
public class CosConfigurationProperties {

    @Schema(description = "密钥Id")
    private String secretId;

    @Schema(description = "密钥Key")
    private String secretKey;

    @Schema(description = "地域")
    private String region;

    @Schema(description = "存储桶名称")
    private String bucketName;

    @Operation(summary = "获取文件访问路径", description = "根据文件名获取文件在腾讯云COS上的访问路径 https://{bucket}.cos.{region}.myqcloud.com/{filename}")
    public String getCosUrl(String fileName) {
        return "https://" + bucketName + ".cos." + region + ".myqcloud.com/" + fileName;

    }

}
